/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DataObject;

import java.io.Serializable;

/**
 *
 * @author MinhNhat
 */
public class MyColumn implements Serializable {

    public String Name;
    public String Type;
    public int id;
    public boolean isKey;

    
    
    public MyColumn(String str, int _id) {
        id = _id;
        str=str.trim();
        int indexOfName = str.indexOf(" ");
        String[] parts = str.split(" ");
        Name = parts[0].trim();
        Type = parts[1].trim();   
        if(parts.length==4)
        {
            if(parts[2].equalsIgnoreCase("primary") && parts[3].equalsIgnoreCase("key"))
            {
                isKey=true;
            }
            else
            {
                isKey = false;
            }
        }
        else
        {
            isKey=false;
        }
    }

    public MyColumn()
    {
        
    }
    public MyColumn(int _id, String name, String type) {
        id = _id;
        Name = name;
        Type = type;
    }

    public void Print() {
        System.out.println(Name + " " + Type);
    }
}
